package com.ywk.base.java8.function;

import java.util.function.Consumer;

/**
 * @author zbh
 * @date 2022/3/21 17:48
 */
public class DemoPrintInfo {
    public static void main(String[] args) {
        String[] array = new String[]{"大雄，男，广东", "静香，女，浙江", "胖虎，男，北京" };
        print(
                a -> System.out.print("姓名："+a.split("，")[0]+"，"),
                a -> System.out.print("性别："+a.split("，")[1]),
                a -> System.out.println("所属地："+a.split("，")[2]),
                array
        );

    }
    static void print(Consumer<String> consumer1,Consumer<String> consumer2,Consumer<String> consumer3,String[] array){
        for (String s : array) {
            consumer1.andThen(consumer2).andThen(consumer3).accept(s);
        }
    }
}
